<?php


/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Education
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
?>
<?php echo $this->partial('index/_js_fields_search.tpl', 'education', array())?>

<div class="headline">
  <h2>
    <?php echo $this->translate('Educations');?>
  </h2>
  <div class="tabs">
    <?php
      // Render the menu
      echo $this->navigation()
        ->menu()
        ->setContainer($this->navigation)
        ->render();
    ?>
  </div>
</div>

<div class='layout_right'>
  <?php echo $this->form->render($this) ?>
  <?php if( count($this->quickNavigation) > 0 ): ?>
    <div class="quicklinks">
      <?php
        // Render the menu
        echo $this->navigation()
          ->menu()
          ->setContainer($this->quickNavigation)
          ->render();
      ?>
    </div>
  <?php endif; ?>
</div>

<div class='layout_middle education_layout_middle'>

  <?php if( $this->tag || $this->keyword):?>
    <div class="educations_result_filter_details">
      <?php echo $this->translate('Showing educations posted'); ?>
      <?php if ($this->tag): ?>
        <?php echo $this->translate('tagging #%s', $this->htmlLink(
          $this->url(array('action'=>'manage', 'tag'=>$this->tag), 'education_general', true),
          $this->tagObject ? $this->tagObject->text : $this->tag
        ));?>
      <?php endif; ?>
      <?php if ($this->keyword): ?>
        <?php echo $this->translate('with keyword %s', $this->htmlLink(
          $this->url(array('action'=>'manage', 'keyword'=>$this->keyword), 'education_general', true),
          $this->keyword
        ));?>
      <?php endif; ?> 
      <?php echo $this->htmlLink(array('action'=>'manage', 'route'=>'education_general'), $this->translate('(x)'))?>
    </div>
  <?php endif; ?>
  
  <?php if( $this->paginator->getTotalItemCount() > 0 ): ?>
  
      <ul class='educations_rows'>
        <?php foreach ($this->paginator as $education): ?>
          <li>
            <div class="education_photo">
              <?php echo $this->htmlLink($education->getHref(), $this->itemPhoto($education, 'thumb.normal'));?>
            </div>  
            <div class="education_options">
              <?php if ($education->authorization()->isAllowed($this->viewer(), 'edit')): ?>
                <?php echo $this->htmlLink(array('route'=>'education_specific', 'action'=>'edit', 'education_id'=>$education->getIdentity()), $this->translate('Edit Education'), array('class'=>'buttonlink icon_education_edit'))?>
              <?php endif; ?>
              <?php if ($education->authorization()->isAllowed($this->viewer(), 'delete')): ?>
                <?php echo $this->htmlLink(array('route'=>'education_specific', 'action'=>'delete', 'education_id'=>$education->getIdentity()), $this->translate('Delete Education'), array('class'=>'buttonlink icon_education_delete'))?>
              <?php endif; ?>
            </div>          
            <div class="education_content">
              <div class="education_title"><h3><?php echo $education->__toString()?></h3></div>
              <div class="education_details">
                <div class="education_details_type">
                  <?php echo $this->translate('School Type: %s', $this->htmlLink($education->getCategory()->getHref(), $this->translate($education->getCategory()->getTitle()))); ?>
                  <?php if ($education->class_year): ?>
                    |
                    <?php echo $this->translate('Class: %s', $education->class_year); ?>
                  <?php endif;?>
                  <?php if ($education->degree): ?>
                    |
                    <?php echo $this->translate('Degree: %s', $education->degree); ?>
                  <?php endif;?>
                </div>
                <?php if ($education->concentration || $education->minor): ?>
                <div class="education_details_focus">
                  <?php if ($education->concentration): ?>
                    <span class="education_concentration"><?php echo $this->translate('Concentrate in %s', $education->concentration); ?></span>
                  <?php endif;?>
                  <?php if ($education->minor): ?>
                    <span class="education_minor"><?php echo $this->translate('with %s minor', $education->minor); ?></span>
                  <?php endif;?>
                </div>
                <?php endif;?>
              </div>
              <div class="education_meta">
                <?php echo $this->translate('Posted on %s', $this->timestamp(strtotime($education->creation_date))) ?></span>
                -
                <?php echo $this->translate(array("%s comment", "%s comments", $education->comment_count), $this->locale()->toNumber($education->comment_count)); ?>
                -
                <?php echo $this->translate(array('%1$s like', '%1$s likes', $education->like_count), $this->locale()->toNumber($education->like_count)); ?>
                -
                <?php echo $this->translate(array('%s view', '%s views', $education->view_count), $this->locale()->toNumber($education->view_count)); ?>
              </div>
              <div class="education_description">
                <?php echo $this->viewMore($education->getDescription()); ?>
              </div>
            </div>
          </li>
        <?php endforeach; ?>  
      </ul>

  <?php elseif($this->tag || $this->keyword): ?>
    <div class="tip">
      <span>
        <?php echo $this->translate('You do not have any educations that match your search criteria.');?>
      </span>
    </div>
  <?php else:?>
    <div class="tip">
      <span>
        <?php echo $this->translate('You do not have any educations.');?>
        <?php if ($this->can_create): ?>
          <?php echo $this->translate('Get started by <a href=\'%1$s\'>posting</a> a new education.', $this->url(array('action'=>'create'), 'education_general'));?>
        <?php endif; ?>
      </span>
    </div>
  <?php endif; ?>

    <?php echo $this->paginationControl($this->paginator, null, null, array(
      'query' => $this->formValues
    )); ?>    

</div>
